#include <stdio.h>
#include <string.h>

int parse_url(char *data)
{
	char *test1 = "<a";
	char *test2 = "href";
	char *test3 = "=";
	char *test4 = "\'";
	char *test5 = ">";
	char *p1,*p;
	char buf[1024];

	 printf("paesr url %s \n",data); 

	memset(buf,'\0',strlen(data));
	
	memmove(buf,data,strlen(data));

	p1 = buf;
	if((p = strstr(buf,test1)) == NULL)
	{
	//	parse_url(p+1);
	}
	p1 = p;

	if((p = strstr(p,test2)) == NULL)
	{
	//	parse_url(p+1);
	}
	
	p1 = p;
	if((p = strstr(p,test3)) == NULL)
	{
	//	parse_url(p+1);
	}
	
	p1 = p;
	if((p = strstr(p,test4)) == NULL)
	{
		//parse_url(p+1);
	}
	
	p1 = ++p;
	if((p = strstr(p,test4)) == NULL)
	{
		//parse_url(p+1);
	}
	
	*p = '\0';

	printf("The result out is:\n%s\n", p1);
	if (strlen(p+1) > 0)
	{
		parse_url(p+1);
	}
	return 0;
}

int main(int argc,char *argv[])
{
	char str1[] = " <a href a b c<a  href = 'www.baidu.com ' > <a  href = 'www.google.com ' > <a  href = 'www.baidu.com ' > <a  href = 'www.baidu.com ' > <a  href = 'www.baidu.com ' > ";
	char *str2 =  "www.google.cn";
	while ( parse_url(str1)  != 0 )
	{
		printf("error!\n"); 
	}
	return 0;
}
